package net.awpspace.mobile.management.point;

import javax.microedition.midlet.MIDlet;
import net.awpspace.mobile.form.BaseForm;
import com.sun.lwuit.Container;
import com.sun.lwuit.Label;
import com.sun.lwuit.TextField;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.layouts.GridLayout;
import com.sun.lwuit.spinner.Spinner;

public class ChiTiet extends BaseForm{
	
    private Diem diem;
	
	private TextField tften,tflop,tfmasv, tftoan,tfly,tfhoa;
	private Spinner ngay,thang,nam;
	private Label lbbirth;
	
	public ChiTiet(MIDlet app, BaseForm parent, Diem d) {
		super(app, parent);
		setTitle("Xem điểm");
		this.diem=d;
		createComponent();
	}
	
	public void createComponent(){
		
		Container con = new Container(new BoxLayout(BoxLayout.Y_AXIS));
		
		Label lbten = new Label("Họ tên");
		tften = new TextField(this.diem.getTen());
		
		Label lblop = new Label("Học lớp");
		tflop = new TextField(this.diem.getLop());
		
		Label lbmasv = new Label("Mã sinh viên");
		tfmasv = new TextField(this.diem.getMasv());
		tfmasv.setConstraint(TextField.NUMERIC);
		tfmasv.setMaxSize(10);
		
		lbbirth = new Label("Ngày sinh: " + diem.getBirth().toString());
		Container birth = new Container(new GridLayout(1, 3));
		ngay = Spinner.create(1, 32, 2, 1);
		thang = Spinner.create(1, 13, 2, 1);
		nam = Spinner.create(1940, 2014, 1991, 1);
		ngay.setValue(new Integer(diem.getBirth().getNgay()));
		thang.setValue(new Integer(diem.getBirth().getThang()));
		nam.setValue(new Integer(diem.getBirth().getNam()));		
		birth.addComponent(ngay);
		birth.addComponent(thang);
		birth.addComponent(nam);

		Label lbtoan = new Label("Điểm toán");
		tftoan = new TextField(this.diem.getToan() + "");
		
		Label lbly = new Label("Điểm lý");
		tfly = new TextField(this.diem.getLy()+ "");
		
		Label lbhoa = new Label("Điểm hóa");
		tfhoa = new TextField(this.diem.getHoa()+ "");
		
		con.addComponent(lbten);
		con.addComponent(tften);
		con.addComponent(lblop);
		con.addComponent(tflop);
		con.addComponent(lbmasv);
		con.addComponent(tfmasv);
		con.addComponent(lbbirth);
		con.addComponent(lbtoan);
		con.addComponent(tftoan);
		con.addComponent(lbly);
		con.addComponent(tfly);
		con.addComponent(lbhoa);
		con.addComponent(tfhoa);
		addComponent(con);
	}
	
	protected void processCommand(ActionEvent e) {
		
	}

}
